#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:5.0

EXPOSE 12001
ENV ASPNETCORE_URLS http://+:12001

COPY . /app
WORKDIR /app

#设置阿里云镜像源
#RUN echo "deb http://mirrors.aliyun.com/debian stretch main contrib non-free \
#deb-src http://mirrors.aliyun.com/debian stretch main contrib non-free \
#deb http://mirrors.aliyun.com/debian stretch-updates main contrib non-free \
#deb-src http://mirrors.aliyun.com/debian stretch-updates main contrib non-free \
#deb http://mirrors.aliyun.com/debian-security stretch/updates main contrib non-free \
#deb-src http://mirrors.aliyun.com/debian-security stretch/updates main contrib non-free \
#deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib \
#deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib" > /etc/apt/sources.list

#RUN apt-get update && apt-get upgrade

#安装puppeteer运行环境
#RUN apt-get install pango.x86_64 libXcomposite.x86_64 libXcursor.x86_64 libXdamage.x86_64 libXext.x86_64 libXi.x86_64 libXtst.x86_64 cups-libs.x86_64 libXScrnSaver.x86_64 #libXrandr.x86_64 #GConf2.x86_64 alsa-lib.x86_64 atk.x86_64 gtk3.x86_64 ipa-gothic-fonts xorg-x11-fonts-100dpi xorg-x11-fonts-75dpi xorg-x11-utils xorg-x11-fonts-cyrillic #xorg-x11-fonts-Type1 #xorg-x11-fonts-misc -y

#RUN apt-get install -y wget unzip fontconfig locales gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 #libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 #libxfixes3 #libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils x11-common wget

#RUN apt-get install -y xserver-xorg libgl1-mesa-dri xfonts-base xfonts-100dpi xfonts-75dpi xfonts-scalable libsm6 libxaw7 libxmu6 libxt6 man-db libxtst6 x11-common #xfonts-encodings x11-apps #x11-utils x11-xkb-utils xinit xfonts-utils xorg libnss3 libasound2 x11-session-utils x11-xserver-utils  xserver-xorg-core  xserver-xorg-video-all #xserver-xorg-input-all xserver-xorg-legacy

#RUN apt-get purge deb9u4
#RUN apt-get install -y xorg


# 设置中文支持
#RUN apt-get install -y locales locales-all
#RUN locale-gen zh_CN.UTF-8 zh_cn && dpkg-reconfigure locales && dpkg-reconfigure locales && locale-gen zh_CN.UTF-8 && /usr/sbin/update-locale LANG=zh_CN.UTF-8
#ENV LANG zh_CN.UTF-8  
#ENV LANGUAGE zh_CN:zh  
#ENV LC_ALL zh_CN.UTF-8

#安装中文字体
#RUN apt-get install ttf-wqy-zenhei
#RUN apt-get install -y xfonts-intl-chinese wqy*


ARG CHROME_VERSION="81.0.4044.138-1"
RUN apt-get update && apt-get -f install && apt-get -y install wget gnupg2 apt-utils
RUN wget --no-verbose -O /tmp/chrome.deb http://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}_amd64.deb \
&& apt-get update \
&& apt-get install -y /tmp/chrome.deb --no-install-recommends --allow-downgrades fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf \
&& rm /tmp/chrome.deb

RUN groupadd -r pptruser && useradd -r -g pptruser -G audio,video pptruser \
    && mkdir -p /home/pptruser/Downloads \
    && chown -R pptruser:pptruser /home/pptruser \
    && chown -R pptruser:pptruser /app

USER pptruser

ENV PUPPETEER_EXECUTABLE_PATH "/usr/bin/google-chrome-stable"

ENTRYPOINT ["dotnet", "LightMaster.dll"]
